<?php

namespace app\saas\command;

use app\common\util\Tools;
use think\console\Input;
use think\console\Output;
use think\facade\Log;

class ManagerTest extends CommonTest
{

    //再命令窗口中执行“php think interface-ManagerTest”
    protected function configure()
    {
        $this->setName('interface-ManagerTest')->setDescription('接口测试');
    }

    public function execute(Input $input, Output $output)
    {
        parent::execute($input, $output);

        //Route::any('saas/manager/getInfo', 'saas/manager/getInfo');                                                            // 管理员基本信息
        $data = Tools::curl($this->url . "saas/manager/getInfo", json_encode(["token" => "$this->token", "id" => 1]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";

        //Route::any('saas/manager/getAccountPageList', 'saas/manager/getAccountList');                                          // 账户列表
        $data = Tools::curl($this->url . "saas/manager/getAccountPageList", json_encode(["token" => "$this->token",]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";

        //Route::any('saas/manager/doModifyPwd', 'saas/manager/doModifyPwd');                                                    // 修改密码
//        $data = Tools::curl($this->url . "saas/manager/doModifyPwd", json_encode(["token" => "$this->token", "id" => 3, "password" => "123456", "confirmPassword" => "123456"]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";

        //Route::any('saas/manager/doAdd', 'saas/manager/doAdd');                                                                // 添加账户
//        $data =        Tools::curl($this->url . "saas/manager/doAdd", json_encode([
//            "token" => "$this->token", "username" => "song", "password" => "123456", "expiredTime" => "2022-04-22", "appCount" => 1, "remark" => "XX", "mobile" => "13682727579"
//        ]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";

        //Route::any('saas/manager/doDelete', 'saas/manager/doDelete');                                                          // 删除账户
//        $data = Tools::curl($this->url . "saas/manager/doDelete", json_encode(["token" => "$this->token", "id" => 2]));
//        Log::write("post". var_export($data,true));
//        echo $data . "\n\n";

    }
}
